From 06bdfbd284b63c5ace60a0dfa58463e9e51163ee Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Thu, 31 May 2007 10:58:22 +0100 Subject: [PATCH] hvm: Exceed maximum number of ioemu's NIC for VNIF. QEMU should ignore excess NICs instead of failing to initialise. Signed-off-by: Takanori Kasai Signed-off-by: Tsunehisa Doi --- tools/ioemu/vl.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tools/ioemu/vl.c b/tools/ioemu/vl.c index b1fe292d9b..50a0a5b0e0 100644 --- a/tools/ioemu/vl.c +++ b/tools/ioemu/vl.c @@ -3965,30 +3965,30 @@ static int net_client_init(const char *str) NICInfo *nd; uint8_t *macaddr; - if (nb_nics >= MAX_NICS) { - fprintf(stderr, "Too Many NICs\n"); - return -1; - } - nd = &nd_table[nb_nics]; - macaddr = nd->macaddr; - macaddr[0] = 0x52; - macaddr[1] = 0x54; - macaddr[2] = 0x00; - macaddr[3] = 0x12; - macaddr[4] = 0x34; - macaddr[5] = 0x56 + nb_nics; - - if (get_param_value(buf, sizeof(buf), "macaddr", p)) { - if (parse_macaddr(macaddr, buf) < 0) { - fprintf(stderr, "invalid syntax for ethernet address\n"); - return -1; + if (nb_nics < MAX_NICS) { + nd = &nd_table[nb_nics]; + macaddr = nd->macaddr; + macaddr[0] = 0x52; + macaddr[1] = 0x54; + macaddr[2] = 0x00; + macaddr[3] = 0x12; + macaddr[4] = 0x34; + macaddr[5] = 0x56 + nb_nics; + + if (get_param_value(buf, sizeof(buf), "macaddr", p)) { + if (parse_macaddr(macaddr, buf) < 0) { + fprintf(stderr, "invalid syntax for ethernet address\n"); + return -1; + } } - } - if (get_param_value(buf, sizeof(buf), "model", p)) { - nd->model = strdup(buf); - } - nd->vlan = vlan; - nb_nics++; + if (get_param_value(buf, sizeof(buf), "model", p)) { + nd->model = strdup(buf); + } + nd->vlan = vlan; + nb_nics++; + } else { + fprintf(stderr, "Too Many NICs\n"); + } ret = 0; } else if (!strcmp(device, "none")) { -- 2.30.2